package com.ebook.eboo.Dao;

import com.ebook.eboo.pojo.Book;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

public interface bookDAO extends JpaRepository<Book,Integer> {

    Book save(Book book);

    Book getByTitle(String title);

    List<Book> getAllBy();

    void deleteBookByTitle(String title);

    @Modifying
    @Query(value = "update Book b set b.title= ?1,b.author= ?2,b.type=?3 ,b.press= ?4where b.id =?5")
    public int updateById(String title,String author,String type,String press,int id);

    List<Book> getAllByType(String type);
}
